function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

function prepareAlertBox() {
	var coupon = $('.coupon');
	var btnComfirm = $('.btnComfirm');
	var btnCancel = $('.btnCancel');
	var num;
	
	$(coupon).on('click', function() {
		$('#alertBox').fadeIn('fast');
		num = parseInt(this.getAttribute('title'));
	});
	$(btnComfirm).on('click', function() {
		// alert(num);
		var img = document.getElementsByTagName('img')[0];//getElementById  unimage
		var url = "__PUBLIC__/img/flsh5-2haodifang_14.png";
		var parentContainer = img.parentNode;
//		alert(parentContainer.getAttribute('class'));
		$('#alertBox').fadeOut('fast');
		img.setAttribute("src",url);
		$(parentContainer).removeClass('.coupon');
//		window.location = "index.html";
		
	});
	
	
	
	
	$(btnCancel).on('click', function() {
		$('#alertBox').fadeOut('fast');
	});
}
//addLoadEvent(prepareAlertBox);
